package org.example.Dao;

import org.apache.ibatis.annotations.*;
import org.example.JavaBean.Emp;

import java.util.List;

/**
 * @Auther:Liu
 * @Testname:EmpDao
 * @Date:2025/7/29 9:57
 */
@Mapper
public interface EmpDao {
    @Select("Select * from emp where state=1")
    public List<Emp> findAll();

    @Select("Select * from emp  where state=1 and ename like #{ename}")
    List<Emp> findByName(String ename);

    @Insert("Insert into emp values (null,#{ename},#{job},#{mgr},now(),#{sal},#{comm},#{deptno},1)")
    int Insert(Emp emp);

    @Delete("Delete from emp where state=1 and empno=#{empno}")
    int delete(Integer empno);

    @Update("Update EMP Set ename=#{ename},job=#{job},mgr=#{mgr},sal=#{sal},comm=#{comm},deptno=#{deptno} where empno=#{empno} ")
    int update(Emp emp);
}
